<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?= $this->SiteLanguage() == "ar" ? "dir='rtl'" : "" ?>>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <?=$this->headLink()->appendStylesheet('/css/Style.css')
                            ->appendStylesheet('http://fonts.googleapis.com/css?family=Inder')
                            ->appendStylesheet('/css/redmond/jquery-ui-1.8.16.custom.css'); ?>

        <link href='http://fonts.googleapis.com/css?family=Inder' rel='stylesheet' type='text/css'/>
     



        <?php
        echo $this->headLink();;
        ?>
        <?=
        $this->headScript()->appendFile('/js/jquery-1.5.2.js')
                ->appendFile('/js/jquery-ui-1.8.16.custom.min.js')
                ->appendFile('/js/swfupload/swfupload.js')
                ->appendFile('/js/jquery.swfupload.js');
        ?>

        <script>
            $(document).ready(function() {
                $("#accordion").accordion();
            });

        </script>
<?php if (Zend_Controller_Front::getInstance()->getRequest()->getControllerName() == 'gallery'): ?>
            <!-- to be moved -->



            <script type="text/javascript">

                $(function(){
                    $('#swfupload-control').swfupload({
                        upload_url: "/admin/gallery/upload",
                        file_post_name: 'uploadfile',
                        file_size_limit : "1024",
                        file_types : "*.jpg;*.png;*.gif",
                        file_types_description : "Image files",
                        file_upload_limit : 5,
                        flash_url : "/js/swfupload/swfupload.swf",
                        button_image_url : '/js/swfupload/wdp_buttons_upload_114x29.png',
                        button_width : 114,
                        button_height : 29,
                        button_placeholder : $('#button')[0],
                        debug: false
                    })
                    .bind('fileQueued', function(event, file){

                        var listitem='<li id="'+file.id+'" >'+
                            'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+
                            '<div class="progressbar" ><div class="progress" ></div></div>'+
                            '<p class="status" >Pending</p>'+
                            '<span class="cancel" >&nbsp;</span>'+
                            '</li>';
                        $('#log').append(listitem);
                        $('li#'+file.id+' .cancel').bind('click', function(){
                            var swfu = $.swfupload.getInstance('#swfupload-control');
                            swfu.cancelUpload(file.id);
                            $('li#'+file.id).slideUp('fast');
                        });
                        // start the upload since it's queued
                        $(this).swfupload('startUpload');
                    })
                    .bind('fileQueueError', function(event, file, errorCode, message){
                        alert('Count is greater than limit');
                    })
                    .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
                        $('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued);
                    })
                    .bind('uploadStart', function(event, file){
                        $('#log li#'+file.id).find('p.status').text('Uploading...');
                        $('#log li#'+file.id).find('span.progressvalue').text('0%');
                        $('#log li#'+file.id).find('span.cancel').hide();
                    })
                    .bind('uploadProgress', function(event, file, bytesLoaded){
                        //Show Progress
                        var percentage=Math.round((bytesLoaded/file.size)*100);
                        $('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
                        $('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
                    })
                    .bind('uploadSuccess', function(event, file, serverData){
                        var item=$('#log li#'+file.id);
                        item.find('div.progress').css('width', '100%');
                        item.find('span.progressvalue').text('100%');
                        var pathtofile='<a href="/images/uploads/'+file.name+'" target="_blank" >view &raquo;</a>';
                        item.addClass('success').find('p.status').html('Done!!! | '+pathtofile);
                    })
                    .bind('uploadComplete', function(event, file){
                            
                        setTimeout(function(){$('#'+file.id).fadeOut('slow')},3000);
                            
                        // upload has completed, try the next one in the queue
                        $(this).swfupload('startUpload');
                    })
    	
                });	

            </script>






        <?php endif; ?>
<?= $this->headScript(); ?>
<?= $this->headTitle(); ?>
    </head>


    <body>
        <div class="container"> 


            <?php echo $this->render('header.phtml'); ?>

            <?php echo $this->layout()->content; ?>

<?php echo $this->render('footer.phtml'); ?>

        </div>
    </body>
</html>
